home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 15CW8LC (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.7 KB  |  42 lines

  1. package com.sun.java.swing.plaf.metal;
  2.  
  3. import com.sun.java.swing.Icon;
  4. import java.awt.Component;
  5. import java.awt.Graphics;
  6. import java.io.Serializable;
  7.  
  8. public class MetalIconFactory$TreeControlIcon implements Icon, Serializable {
  9.    protected boolean isLight;
  10.  
  11.    public MetalIconFactory$TreeControlIcon(boolean isLight) {
  12.       this.isLight = isLight;
  13.    }
  14.  
  15.    public void paintIcon(Component c, Graphics g, int x, int y) {
  16.       g.translate(x, y);
  17.       g.setColor(this.isLight ? MetalLookAndFeel.getPrimaryControl() : MetalLookAndFeel.getPrimaryControlDarkShadow());
  18.       g.fillRect(1, 1, 6, 6);
  19.       g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
  20.       g.drawLine(0, 2, 0, 5);
  21.       g.drawLine(1, 1, 1, 1);
  22.       g.drawLine(2, 0, 5, 0);
  23.       g.drawLine(6, 1, 6, 1);
  24.       g.drawLine(7, 2, 7, 5);
  25.       g.drawLine(6, 6, 6, 6);
  26.       g.drawLine(2, 7, 5, 7);
  27.       g.drawLine(1, 6, 1, 6);
  28.       g.setColor(this.isLight ? MetalLookAndFeel.getPrimaryControlHighlight() : MetalLookAndFeel.getPrimaryControlShadow());
  29.       g.drawLine(1, 2, 1, 5);
  30.       g.drawLine(2, 1, 5, 1);
  31.       g.translate(-x, -y);
  32.    }
  33.  
  34.    public int getIconWidth() {
  35.       return MetalIconFactory.access$treeControlSize().width;
  36.    }
  37.  
  38.    public int getIconHeight() {
  39.       return MetalIconFactory.access$treeControlSize().height;
  40.    }
  41. }
  42.